smol
A small and fast async runtime.
This crate simply re-exports other smaller async crates (see the source).
To use tokio-based libraries with smol, apply the async-compat
adapter to futures and I/O
types.
Examples
Connect to an HTTP website, make a GET request, and pipe the response to the standard output:
use ;
There's a lot more in the examples directory.
Subcrates
- async-channel - Multi-producer multi-consumer channels
- async-executor - Composable async executors
- async-fs - Async filesystem primitives
- async-io - Async adapter for I/O types, also timers
- async-lock - Async locks (barrier, mutex, reader-writer lock, semaphore)
- async-net - Async networking primitives (TCP/UDP/Unix)
- async-process - Async interface for working with processes
- async-task - Task abstraction for building executors
- blocking - A thread pool for blocking I/O
- futures-lite - A lighter fork of futures
- polling - Portable interface to epoll, kqueue, event ports, and wepoll
TLS certificate
Some code examples are using TLS for authentication. The repository contains a self-signed certificate usable for testing, but it should not be used for real-world scenarios. Browsers and tools like curl will show this certificate as insecure.
In browsers, accept the security prompt or use curl -k
on the
command line to bypass security warnings.
The certificate file was generated using minica and openssl:
minica --domains localhost -ip-addresses 127.0.0.1 -ca-cert certificate.pem
openssl pkcs12 -export -out identity.pfx -inkey localhost/key.pem -in localhost/cert.pem
Another useful tool for making certificates is mkcert.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.